return surface;
}
-/**
- * gdk_surface_get_parent:
- * @surface: a #GtkSurface
- *
- * Returns the parent surface of a surface, or
- * %NULL if the surface does not have a parent.
- *
- * Only popup surfaces have parents.
- *
- * Returns: (transfer none) (nullable): the parent of
- * @surface, or %NULL
- */
-GdkSurface *
-gdk_surface_get_parent (GdkSurface *surface)
-{
- g_return_val_if_fail (GDK_IS_SURFACE (surface), NULL);
-
- return surface->parent;
-}
-
static void
update_pointer_info_foreach (GdkDisplay *display,
GdkDevice *device,
return GDK_SURFACE_DESTROYED (surface);
}
-/**
- * gdk_surface_get_position:
- * @surface: a #GdkSurface
- * @x: (out): X coordinate of surface
- * @y: (out): Y coordinate of surface
- *
- * Obtains the position of the surface relative to its parent.
- **/
-void
-gdk_surface_get_position (GdkSurface *surface,
- int *x,
- int *y)
-{
- g_return_if_fail (GDK_IS_SURFACE (surface));
-
- if (surface->parent)
- {
- *x = surface->x;
- *y = surface->y;
- }
- else
- {
- *x = 0;
- *y = 0;
- }
-}
-
/**
* gdk_surface_get_mapped:
* @surface: a #GdkSurface
GDK_SURFACE_GET_CLASS (surface)->toplevel_resize (surface, width, height);
}
-/**
- * gdk_surface_present_popup:
- * @surface: the popup #GdkSurface to show
- * @width: the unconstrained popup width to layout
- * @height: the unconstrained popup height to layout
- * @layout: the #GdkPopupLayout object used to layout
- *
- * Present @surface after having processed the #GdkPopupLayout rules. If the
- * popup was previously now showing, it will be showed, otherwise it will
- * change position according to @layout.
- *
- * After calling this function, the result of the layout can be queried
- * using gdk_surface_get_position(), gdk_surface_get_width(),
- * gdk_surface_get_height(), gdk_surface_get_popup_rect_anchor() and
- * gdk_surface_get_popup_surface_anchor().
- *
- * Presenting may have fail, for example if it was immediately hidden if the
- * @surface was set to autohide.
- *
- * Returns: %FALSE if it failed to be presented, otherwise %TRUE.
- */
-gboolean
-gdk_surface_present_popup (GdkSurface *surface,
- int width,
- int height,
- GdkPopupLayout *layout)
-{
- g_return_val_if_fail (GDK_IS_SURFACE (surface), FALSE);
- g_return_val_if_fail (surface->parent, FALSE);
- g_return_val_if_fail (layout, FALSE);
- g_return_val_if_fail (!GDK_SURFACE_DESTROYED (surface), FALSE);
- g_return_val_if_fail (width > 0 && height > 0, FALSE);
-
- return GDK_SURFACE_GET_CLASS (surface)->present_popup (surface,
- width,
- height,
- layout);
-}
-
-/**
- * gdk_surface_get_popup_surface_anchor:
- * @surface: a #GdkSurface
- *
- * Get the current popup surface anchor. The value returned may chage after
- * calling gdk_surface_show_popup(), gdk_surface_layout_popup() or after the
- * "popup-layout-changed" is emitted.
- */
-GdkGravity
-gdk_surface_get_popup_surface_anchor (GdkSurface *surface)
-{
- return surface->popup.surface_anchor;
-}
-
-/**
- * gdk_surface_get_popup_rect_anchor:
- * @surface: a #GdkSurface
- *
- * Get the current popup anchor rectangle anchor. The value
- * returned may chage after calling gdk_surface_show_popup(),
- * gdk_surface_layout_popup() or after the "popup-layout-changed" is emitted.
- */
-GdkGravity
-gdk_surface_get_popup_rect_anchor (GdkSurface *surface)
-{
- return surface->popup.rect_anchor;
-}
-
static gboolean
gdk_popup_surface_present (GdkPopup *popup,
int width,
GdkSurface *surface = GDK_SURFACE (popup);
g_return_val_if_fail (surface->surface_type == GDK_SURFACE_POPUP, FALSE);
+ g_return_val_if_fail (surface->parent, FALSE);
+ g_return_val_if_fail (!GDK_SURFACE_DESTROYED (surface), FALSE);
- return gdk_surface_present_popup (surface, width, height, layout);
+ return GDK_SURFACE_GET_CLASS (surface)->present_popup (surface, width, height, layout);
}
static GdkGravity
g_return_val_if_fail (surface->surface_type == GDK_SURFACE_POPUP, GDK_GRAVITY_STATIC);
- return gdk_surface_get_popup_surface_anchor (surface);
+ return surface->popup.surface_anchor;
}
static GdkGravity
g_return_val_if_fail (surface->surface_type == GDK_SURFACE_POPUP, GDK_GRAVITY_STATIC);
- return gdk_surface_get_popup_rect_anchor (surface);
+ return surface->popup.rect_anchor;
}
static int
return TRUE;
}
-
-/**
- * gdk_surface_get_autohide:
- * @surface: a #GdkSurface
- *
- * Returns whether this surface is set to hide on outside clicks.
- *
- * Returns: %TRUE if @surface will autohide
- */
-gboolean
-gdk_surface_get_autohide (GdkSurface *surface)
-{
- g_return_val_if_fail (GDK_IS_SURFACE (surface), FALSE);
-
- return surface->autohide;
-}
-